package cn.com.backstage.controller;

import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.Date;
import java.text.SimpleDateFormat;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.collections.map.HashedMap;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import cn.com.api.entity.ApiT_user_admin;
import cn.com.api.entity.ApiU_bonus_detail;
import cn.com.api.entity.U_cate;
import cn.com.api.entity.test;
import cn.com.api.service.ApiU_bonus_detailService;
import cn.com.backstage.controller.base.U_bonus_detailBaseController;

import cn.com.util.*;
import cn.com.util.*;

@Controller
@RequestMapping(Utils.SYS_BACKSTAGE + "/")
public class U_bonus_detailController extends U_bonus_detailBaseController {

	private static Logger logger = Logger.getLogger(U_bonus_detailController.class);

	@Autowired
	private ApiU_bonus_detailService apiU_bonus_detailService;

	@RequestMapping(value = "textaaa")
	public void textaaa(HttpServletRequest request, HttpServletResponse response) throws Exception {
		// List<test> list = new ArrayList<test>();
		// for (int i = 0; i < 10; i++) {
		// test test = new test();
		// test.setA("dawda");
		// test.setB("dawdawd");
		// test.setC("fafefefs");
		// list.add(test);
		// }
		String menuTreeIds = "1,2,3,4,5,6";
		List<test> list = new ArrayList<test>();
		Map<String, Object> _map = new HashMap<String, Object>();
		String[] menuIds = menuTreeIds.split(",");
		int result = -1;
		for (int i = 0; i < menuIds.length; i++) {
			test um = new test();
			um.setMenuId(menuIds[i]);
			um.setUnitId(i + "");
			list.add(um);
		}
		_map.put("list0", list);
		apiU_bonus_detailService.insertU_bonus_details(_map);
		// unitMenuMapper.addUnitPower(_map);
		System.out.println("================================================_map = " + _map.toString());
		result = (Integer) _map.get("result0");
		System.out.println("================================================result = " + result);

		// Map map = new HashMap<String, String>();
		// map.put("val1", 1);
		// apiU_bonus_detailService.inserts(map);
		// System.out.println(map.get("val2"));
	}

}
